{% macro render_pagination(pagination, endpoint) %}
<ul class="pagination" style="margin: 0;">
    <li class="{% if not pagination.prev_num %}disabled{% endif %}"><a href="{% if not pagination.prev_num %} # {%else%} {{url_for(endpoint, page=pagination.prev_num)}} {% endif %}">«</a></li>
    {% for page in pagination.iter_pages() %}
        {% if page %}
            {% if page != pagination.page %}
                <li><a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a></li>
            {% else %}
                <li class="active"><a href="#">{{ page }}</a></li>
            {% endif %}
        {% else %}
            <li><span class=ellipsis>…</span></li>
        {% endif %}
    {% endfor %}
    <li class="{% if not pagination.next_num %}disabled{% endif %}"><a href="{% if not pagination.next_num %} # {% else %} {{url_for(endpoint, page=pagination.next_num)}} {% endif %}">»</a></li>
</ul>
{% endmacro %}